<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/x-template" id="pushNews">
    <div id="push">
        <div class="confirm">
            <div class="confirm-box">
                <div class="confirm-title">温馨提示</div>
                <div class="confirm-text">
                    您确定推送这条（些）新闻吗？
                </div>
                <div class="confirm-button">
                    <div class="confirm-sure" @click="sureDel()">确定</div>
                    <div class="confirm-cancel" @click="cancel()">取消</div>
                </div>
            </div>
        </div>
    </div>
</script>
<script>
    var pushNews = {
        template: '#pushNews',
        data: function() {
            return {
                newsId: "",
                index: "",
                thisPage: ""
            }
        },
        ready : function () {
            var thisUrl = window.location.href.split('.jsp');
            var thisaa = thisUrl[0].substr(thisUrl[0].length-4);
            this.thisPage = thisaa + ".jsp";
            //console.log(this.thisPage);
        },
        methods: {
            cancel: function() {
                this.$dispatch('pushHide');
            },
            sureDel: function() {
                eeesysLoading();
                var _this = this;
                console.log(_this.newsId);
                $.ajax({
                    type: 'POST',
                    url: _this.thisPage,
                    data: {
                        act: "set_news_list",
                        hospital: "1070",
                        news_ids: _this.newsId,
                        status: 1
                    },
                    success: function (res) {
                        eeesysLoadingCancel();
                        res = JSON.parse(res);
                        if(res.errcode == 0) {
                            layer.open({
                                title: '提示',
                                content: '发布成功!',
                                yes: function(index, layero) {
                                    _this.$dispatch('succPush');
                                    layer.close(index);
                                }
                            })
                        } else {
                            layer.open({
                                title: '提示',
                                content: res.errmsg
                            })
                        }
                    }
                })
            }
        },
        events: {
            getPushid: function(id) {
                this.newsId = id;
            }
        }
    }

</script>


<style>
    body {
        background-color: #F1F2F7!important;
    }
    a {
        color: #646464;

    }
    a:hover {
        text-decoration: none;
        color: #646464;
    }
    #push {
        background-color: rgba(0,0,0,.3);
        width: 100%;
        height: 100%;
        position: fixed;
        left: 0;
        top: 0;
    }
    .confirm {
        position: absolute;
        left: 50%;
        margin-left: -200px;
        top: 50%;
        margin-top: -65px;

    }
    .confirm-box {
        width: 400px;
        background-color: #fff;
        border-radius: 7px;
        text-align: center;
    }
    .confirm-title {
        background-color: #68cacb;
        color: #fff;
        line-height: 40px;
        border-radius: 7px 7px 0 0;
    }
    .confirm-text {
        text-align: left;
        padding: 15px;
    }
    .confirm-sure,
    .confirm-cancel {
        display: inline-block;
        padding: 3px 20px;
        background-color: #68cacb;
        color: #fff;
        margin-bottom: 15px;
        cursor: pointer;
        border-radius: 3px;
    }
    .confirm-sure {
        margin-right: 25px;
    }
</style>